/**********************************************
*  Namespace: AI
*  Classes:   SteeringSeek
*  Desc:      Updates positions using a seek
*             algorithm in 2d or 3d cases
*  Author:    Vaios Kalpias-Ilias (C) 2008-2009
***********************************************/

#include "SteeringSeek.h"
#include "Helper.h"

namespace AI
{
	//---------------------------------------------
	/**
	* Ctor
	*/
	SteeringSeek::SteeringSeek()
	{
	}
	//---------------------------------------------
	/**
	* Dtor
	*/
	SteeringSeek::~SteeringSeek()
	{
	}
	//---------------------------------------------
	/**
	* Returns new steering data in 2d
	*/
	Steering2d SteeringSeek::GetSteering(const Kinematic2d& current,
									   const Kinematic2d& target)
	{
		Steering2d steering;
		// get the direction to the target
		steering.linear = target.position - current.position;
		// give full acceleration along this direction
		steering.linear.Normalize();
		steering.linear *= maxAcceleration;

		// output steering
		return steering;
	}

}
